package model

import (
	"gorm.io/gorm"
	"time"
)

type ChatHistory struct {
	Id       uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserOne  uint           `gorm:"column:user_one;type:bigint(20) UNSIGNED;not null;default:0;" json:"user_one"`
	UserTwo  uint           `gorm:"column:user_two;type:bigint(20) UNSIGNED;not null;default:0;" json:"user_two"`
	RoomId   uint           `gorm:"column:room_id;type:bigint(20) UNSIGNED;not null;default:0;" json:"room_id"`
	Content  string         `gorm:"column:content;type:varchar(255);not null;" json:"content"`
	CreateAt time.Time      `gorm:"column:create_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"create_at"`
	UpdateAt time.Time      `gorm:"column:update_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"update_at"`
	DeleteAt gorm.DeletedAt `gorm:"column:delete_at;type:datetime(3);default:NULL;" json:"delete_at"`
}

func (c *ChatHistory) TableName() string {
	return "chat_history"
}
